Fix build with statically-linked Python interpreter and bump minimum required version to CMake 3.16 #325
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks a lot for all the work on this project!
In RoboStack/ros-humble#275 we tried to build it in robostack, but we experienced some linking errors, that were created by the setting of the
-Wl,--no-undefinedlinking option applied to Python extensions.In some cases, Python extensions are intentionally not linked to the
libpythonshared library (as for example when linking to thePython::Moduleimported library, see https://gitlab.kitware.com/cmake/cmake/-/blob/v4.0.0/Modules/FindPython/Support.cmake?ref_type=tags#L4206), mostly to ensure support for Python interpreters that statically link thelibpythonlibrary (see astral-sh/python-build-standalone#540). So, in general setting-Wl,--no-undefinedfor Python extensions can lead to linkin errors.To avoid this problem, this PR uses
target_link_optionsin place oflink_optionsto only setspatio_temporal_voxel_layer_corefor thespatio_temporal_voxel_layer_core. The script falls back to uselink_optionsif using a version of CMake <= 3.13 .If the minimum version of CMake required by the project can be raised to 3.16 (that was the minimum version of CMake required by ROS 2 Foxy that reached the EOL in May 2023, see https://www.ros.org/reps/rep-2000.html#foxy-fitzroy-may-2020-may-2023), the code can be simplified to remove the check on CMake ersion.